/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2017
 */

package com.cbwl.eoas.cms.model.sysconfig;

import java.util.List;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.springframework.util.StringUtils;

import com.cbwl.eoas.common.base.CommonBean;
import com.cbwl.eoas.common.cache.redis.RedisCache;
import com.cbwl.eoas.common.cache.redis.RedisKeyPrefix;
import com.cbwl.eoas.common.util.SpringContextUtil;


/**
 * 
 * <p>[描述信息：说明类的基本功能]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年10月20日 下午5:24:52
 */
public class SysResourceDTO extends CommonBean {

	

	

	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4937575982986191301L;

	private java.lang.Long id;
	
	private java.lang.Long pid;
	private java.lang.String name;
	
	private String resourceType;
	@Length(max=64)
	private java.lang.String resourceValue;
	@Length(max=128)
	private java.lang.String resourceUri;
	@Length(max=128)
	private java.lang.String resourceIcon;
	@Length(max=5)
	private java.lang.String resourceStatus;
	
	private java.lang.Integer orders;
	
	private java.lang.Long creater;
	
	private java.util.Date gmtCreate;
	
	private java.lang.Long modifier;
	
	private java.util.Date gmtModified;
	
	private java.lang.Long lastVersionNo;
	
	//查询类型1：表示查询目录和菜单
	private String selectType;
	
	//菜单类型(原生的，h5)
	private String menuType;
	
	private Long uid;
	//columns END
	
	private String resourceStatusName;
	
	private String resourceTypeName;
	
	private String menuTypeName;
	
	
	private List<SysResourceDTO> sonList;
	

	public void setId(java.lang.Long value) {
		this.id = value;
	}
	
	public java.lang.Long getId() {
		return this.id;
	}
	
	public void setPid(java.lang.Long value) {
		this.pid = value;
	}
	
	public java.lang.Long getPid() {
		return this.pid;
	}
	
	public java.lang.String getName() {
		return name;
	}

	
	public void setName(java.lang.String name) {
		this.name = name;
	}

	public String getResourceType() {
		return resourceType;
	}

	
	public void setResourceType(String resourceType) {
		this.resourceType = resourceType;
		if (!StringUtils.isEmpty(resourceType)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+resourceType);
			if (!StringUtils.isEmpty(redisValue)) {
				this.resourceTypeName = redisValue;
			}
		}
	}

	public void setResourceValue(java.lang.String value) {
		this.resourceValue = value;
	}
	
	public java.lang.String getResourceValue() {
		return this.resourceValue;
	}
	
	public void setResourceUri(java.lang.String value) {
		this.resourceUri = value;
	}
	
	public java.lang.String getResourceUri() {
		return this.resourceUri;
	}
	
	public void setResourceIcon(java.lang.String value) {
		this.resourceIcon = value;
	}
	
	public java.lang.String getResourceIcon() {
		return this.resourceIcon;
	}
	
	public void setResourceStatus(java.lang.String value) {
		this.resourceStatus = value;
		if (!StringUtils.isEmpty(value)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+value);
			if (!StringUtils.isEmpty(redisValue)) {
				this.resourceStatusName = redisValue;
			}
		}
	}
	
	public java.lang.String getResourceStatus() {
		return this.resourceStatus;
	}
	
	public void setOrders(java.lang.Integer value) {
		this.orders = value;
	}
	
	public java.lang.Integer getOrders() {
		return this.orders;
	}
	
	public void setCreater(java.lang.Long value) {
		this.creater = value;
	}
	
	public java.lang.Long getCreater() {
		return this.creater;
	}
	
	public void setGmtCreate(java.util.Date value) {
		this.gmtCreate = value;
	}
	
	public java.util.Date getGmtCreate() {
		return this.gmtCreate;
	}
	
	public void setModifier(java.lang.Long value) {
		this.modifier = value;
	}
	
	public java.lang.Long getModifier() {
		return this.modifier;
	}
	
	public void setGmtModified(java.util.Date value) {
		this.gmtModified = value;
	}
	
	public java.util.Date getGmtModified() {
		return this.gmtModified;
	}
	
	public void setLastVersionNo(java.lang.Long value) {
		this.lastVersionNo = value;
	}
	
	public java.lang.Long getLastVersionNo() {
		return this.lastVersionNo;
	}
	
	public String getSelectType() {
		return selectType;
	}
	
	public void setSelectType(String selectType) {
		this.selectType = selectType;
	}
	
	public String getMenuType() {
		return menuType;
	}
	
	public List<SysResourceDTO> getSonList() {
		return sonList;
	}
	
	public void setSonList(List<SysResourceDTO> sonList) {
		this.sonList = sonList;
	}

	public void setMenuType(String menuType) {
		this.menuType = menuType;
		if (!StringUtils.isEmpty(menuType)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+menuType);
			if (!StringUtils.isEmpty(redisValue)) {
				this.menuTypeName = redisValue;
			}
		}
	}
	
	public Long getUid() {
		return uid;
	}

	
	public void setUid(Long uid) {
		this.uid = uid;
	}

	
	public String getResourceStatusName() {
		return resourceStatusName;
	}

	
	public void setResourceStatusName(String resourceStatusName) {
		this.resourceStatusName = resourceStatusName;
	}
	
	public String getResourceTypeName() {
		return resourceTypeName;
	}
	
	public void setResourceTypeName(String resourceTypeName) {
		this.resourceTypeName = resourceTypeName;
	}

	
	public String getMenuTypeName() {
		return menuTypeName;
	}

	
	public void setMenuTypeName(String menuTypeName) {
		this.menuTypeName = menuTypeName;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Pid",getPid())
			.append("Name",getName())
			.append("ResourceType",getResourceType())
			.append("MenuType",getMenuType())
			.append("ResourceValue",getResourceValue())
			.append("ResourceUri",getResourceUri())
			.append("ResourceIcon",getResourceIcon())
			.append("ResourceStatus",getResourceStatus())
			.append("Orders",getOrders())
			.append("Creater",getCreater())
			.append("GmtCreate",getGmtCreate())
			.append("Modifier",getModifier())
			.append("GmtModified",getGmtModified())
			.append("LastVersionNo",getLastVersionNo())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof SysResourceDTO == false){return false;}
		if(this == obj){return true;}
		SysResourceDTO other = (SysResourceDTO)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
	
}

